<?php

    /**
     * @package      Modules
     * @subpackage   Admins_Classes_Db
	 *
     * @license      GNU Lesser General Public Licence see LICENCE-LGPL file or http://www.gnu.org/licenses/lgpl.html
     */
    class DbAdmin extends BaseDbAdmin
    {

    ////////////////////////////////////////////////////////////////////////////
	//                                Methods                                 //
	////////////////////////////////////////////////////////////////////////////

        /**
         * __toString override
         *
         * @return      string
         */
        public function __toString()
        {
            return $this->login;
        }
        
        /**
         * Get a random password
         * 
         * @param       string      $length
         */
        public static function getRandomPassword($length = 8)
        {
			$password = "";
			
			$possible = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
			  
			$i = 0; 
			
			while ($i < $length) { 
				$char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
				
				if (!strstr($password, $char)) { 
					$password .= $char;
					$i++;
				}
			}
			
			return $password;
        }
        
    }